package _13_lianxi;

import java.util.HashSet;
import java.util.Set;

public class Case {

	public static void main(String[] args) {
		HashSet<Case1> s = new HashSet<Case1>();
		Case1 c1 = new Case1("001", "123456", "张三");
		Case1 c2 = new Case1("002", "123434", "李四");
		Case1 c3 = new Case1("003", "123456", "张三");
		Case1 c4 = new Case1("004", "423223", "王五");
		Case1 c5 = new Case1("005", "543342", "赵六");
		s.add(c1);
		s.add(c2);
		s.add(c3);
		s.add(c4);
		s.add(c5);
		for (Object object : s) {
			System.out.println(object);
		}

	}

}

class Case1 {
	private String number;
	private String idNumber;
	private String name;

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getIdNumber() {
		return idNumber;
	}

	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Case1(String number, String idNumber, String name) {
		super();
		this.number = number;
		this.idNumber = idNumber;
		this.name = name;
	}

	public Case1() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj instanceof Case1) {
			Case1 a = (Case1) obj;
			if (idNumber.equals(a.idNumber)) {
				return true;
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return idNumber.hashCode();
	}

	@Override
	public String toString() {
		return "Case1 [number=" + number + ", idNumber=" + idNumber + ", name=" + name + "]";
	}
}